USE MainDatabase

if not exists (SELECT * FROM syscolumns WHERE (name = 'StatusDate') AND (id = OBJECT_ID(N'[dbo].[history]')))
ALTER TABLE history ADD StatusDate datetime NULL

